﻿using System;
using System.Collections.Generic;
using System.Windows;

namespace VSTalk.Engine.Core.EnvironmentManagers.UI
{
    public class ResourceStore : IResourceStore
    {
        private static IWindowManager WindowManager
        {
            get { return AppServices.Get<IWindowManager>(); }
        }

        private static IThemeManager ThemeManager
        {
            get { return WindowManager.ThemeManager; }
        }

        public IList<ResourceDictionary> GetActualResources()
        {
            var resources = new List<ResourceDictionary>();
            var dynamicResources = new List<string>
            {
                "pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml", 
                "pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml",
                "pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml",
                "pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml",
                "pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml",
                "pack://application:,,,/VSTalk.Extension;component/Styles/ButtonStyle.xaml"
            };

            if (ThemeManager.ActiveTheme == ThemeMode.Dark)
            {
                dynamicResources.Add("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml");
            }
            else
            {
                dynamicResources.Add("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml");
            }

            foreach (var resource in dynamicResources)
            {
                var rDictionary = new ResourceDictionary();
                rDictionary.Source = new Uri(resource);
                resources.Add(rDictionary);
            }
            return resources;
        }
    }
}